package com.jason.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置视图映射
 */
////@EnableWebMvc
@Configuration
public class WebViewMappingConfig implements WebMvcConfigurer {

    /**
     * Override this method to add view controllers.
     *
     * @param registry
     * @see ViewControllerRegistry
     */
//    @Override
//    public void addViewControllers(ViewControllerRegistry registry) {
//
//        List<ViewMapping> vmList = new ArrayList<>();
//        vmList.add(new ViewMapping("/", "index"));
//        vmList.add(new ViewMapping("/user/login", "login"));
//        vmList.add(new ViewMapping("/registry", "register"));
//
//        vmList.forEach(vm -> registry.addViewController(vm.urlPath).setViewName(vm.viewName));
//
//    }
//
//    class ViewMapping {
//        private String urlPath;
//        private String viewName;
//
//        public ViewMapping(String urlPath, String viewName) {
//            this.urlPath = urlPath;
//            this.viewName = viewName;
//        }
//    }
}
